﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace OrderManagement
{
    [Serializable]
    public  class Customers
    {
        [Key]
       public String Name { get; set; }
       public String Address { get; set; } //送货地址
      // public DateTime OrderTime { get; set; } //下单时间
       public String Phone { get; set; } //顾客手机号码

       public Customers(String Name,String Address,String Phone)
        {
            this.Name = Name;
            this.Address = Address;
            this.Phone = Phone;
        }
        public Customers() { }
        public override string ToString()
        {
            return ($"顾客姓名：{Name}，送货地址{Address}，手机号码{Phone}");
        }
        public override bool Equals(object obj)
        {
            Customers a = obj as Customers;
            return a != null && a.Address == this.Address && a.Name == this.Name && a.Phone == this.Phone;
        }

        public override int GetHashCode()
        {
            int hashCode = -853315424;
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Name);
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Address);
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Phone);
            return hashCode;
        }
    }
}
